import BuffUtil from '@/BuffUtil';
import BuffCommon from 'code/Core/Common/BuffCommon';
import AbilityBase from 'code/Scripts/Abilities/base/AbilityBase';
/**
 * 紧急进攻
 **/
export default class YX_UrgencyAttack extends AbilityBase {
    static instance: YX_UrgencyAttack;
    buffType: AppBuffType = {
        id: 'buff_YX_UrgencyAttack',
        art: this.art,
        name: this.abilityName,
        ubertip: '在持续时间内降低你的攻击间隔',
        dur: 12,
        attribute: {
            damage_cool: -0.08,
        },
        stackCountMax: -1,
        targetAttach: 'left hand',
        targetArt: 'Abilities\\Spells\\Items\\WandOfNeutralization\\NeutralizationMissile.mdl',
    };
    constructor(id: string = 'Ajjg') {
        super(id);
        YX_UrgencyAttack.instance = this;
        this.init();
        se.onUnitSpellEffect(this.onSpellEffect.bind(this), this.id);
    }
    init() {
        BuffUtil.registerBuffType(this.buffType);
    }
    cast<T extends Object = any>(tarX: number, tarY: number, source: unit, target: unit, data?: T): void {
        BuffCommon.addBuff({
            target,
            caster: source,
            buffTypeId: this.buffType.id,
            ablityId: this.id,
            config: { stack: this.getAbilityLevel(source) },
        });
    }
    onSpellEffect() {
        this.cast(GetSpellTargetX(), GetSpellTargetY(), GetTriggerUnit(), GetSpellTargetUnit());
    }
}
